现在我们将使用碰撞事件,来更改球与砖块或挡板碰撞后的移动。
- 从 中,拖出一个 Collision with Shape。在事件处理器中将事件分配给 ball。
- 使用 Global Variable 以更新 score。将其直接放置在定义碰撞事件的代码行下方。
- 当其在 collision() 事件中使用的任何位置,将变量 my_var 更改为 color。
- 更改第一个 if 语句以测试挡板的颜色,更改第二个 if 语句以测试砖块的颜色。
To navigate the page using the TAB key, first press ESC to exit the code editor.